const { cleanEnv, str, num, bool } = require("envalid");
const dotenv = require("dotenv").config();

const env = cleanEnv(process.env, {
    PORT: num({ default: 3000 }),
    NODE_ENV: str({
        choices: ["development", "production"],
        default: "development",
    }),
    SESSION_SECRET: str({ default: "cowen is the best" }),
    SESSION_EXPIRATION: str({ default: "1d" }),
    SECRETID: str(),
    SECRETKEY: str(),
    DB_URL: str(),
    ASSETS_URL: str(),
});

module.exports = {
    PORT: env.PORT,
    NODE_ENV: env.NODE_ENV,
    SESSION_SECRET: env.SESSION_SECRET,
    SESSION_EXPIRATION: env.SESSION_EXPIRATION,
    DB_URL: env.DB_URL,
    SECRETID: env.SECRETID,
    SECRETKEY: env.SECRETKEY,
    ASSETS_URL: env.ASSETS_URL,
};
